package com.zhaolixiang.slidetabview

import android.app.Activity
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.view.ViewGroup
import android.widget.Button
import android.widget.TextView
import kotlinx.android.synthetic.main.activity_main2.*

class Main2Activity : AppCompatActivity() {
    private var count=400;
    private lateinit var activity: Activity
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main2)
        activity=this
        //开启动画效果
        ///mHorizontalScrollView.setSmoothScrollingEnabled(true);
        for(i in 0 until count){
            addView(i)
        }
        bt_add.setOnClickListener{
            val tv=TextView(activity)
            tv.text="我是文本"+(8)
            tv.textSize=36f
            ll_zong.addView(tv,0)
        }
    }
    fun addView( i:Int){
        val tv= Button(activity)
        val params=ViewGroup.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                100
        )
        tv.text="我是文本"+(i%4)
        tv.textSize=36f
        //tv.layoutParams=params
        ll_zong.addView(tv)

    }
}
